<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.10"/>
<title>sock: E:/git/sock/sock/http/http_buffer.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">sock
   &#160;<span id="projectnumber">v0.11</span>
   </div>
   <div id="projectbrief">C++ Network Library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.10 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_885cc87fac2d91e269af0a5a959fa5f6.html">E:</a></li><li class="navelem"><a class="el" href="dir_4e091ed8704426a7a4980368ba259fde.html">git</a></li><li class="navelem"><a class="el" href="dir_99ede9081e3122cb31ab1bd7b142cd6c.html">sock</a></li><li class="navelem"><a class="el" href="dir_7c33e989e8c050d7b2ba91a16c41033d.html">sock</a></li><li class="navelem"><a class="el" href="dir_2a6edac14fe64ddd5f5b32a053fdeecc.html">http</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">http_buffer.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="http__buffer_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/******************************************************************************</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * Name         : http_buffer.h</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> * Author       : 671643387</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * Date         : 2015年10月12日</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> * Description  :</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> *****************************************************************************/</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;</div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor">#ifndef DEPS_SOCK_SOCK_HTTP_HTTP_BUFFER_H_</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#define DEPS_SOCK_SOCK_HTTP_HTTP_BUFFER_H_</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;</div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#include &lt;memory.h&gt;</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#include &lt;string.h&gt;</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &lt;boost/noncopyable.hpp&gt;</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#include &lt;boost/shared_ptr.hpp&gt;</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="tcp__connection__output__stream_8h.html">sock/net/tcp_connection_output_stream.h</a>&gt;</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;</div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacesock.html">sock</a></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;{</div>
<div class="line"><a name="l00020"></a><span class="lineno"><a class="line" href="namespacesock_1_1http.html">   20</a></span>&#160;    <span class="keyword">namespace </span>http</div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;    {</div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;        <span class="keyword">class </span><a class="code" href="classsock_1_1http_1_1_http_session.html">HttpSession</a>;</div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;</div>
<div class="line"><a name="l00027"></a><span class="lineno"><a class="line" href="classsock_1_1http_1_1_http_buffer.html">   27</a></span>&#160;        <span class="keyword">class </span><a class="code" href="classsock_1_1http_1_1_http_buffer.html">HttpBuffer</a> : <span class="keyword">public</span> boost::noncopyable</div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;        {</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;        <span class="keyword">public</span>:</div>
<div class="line"><a name="l00030"></a><span class="lineno"><a class="line" href="classsock_1_1http_1_1_http_buffer.html#a1ecfa607483d6818c6eaddc982dc7949">   30</a></span>&#160;            <span class="keyword">typedef</span> <a class="code" href="classsock_1_1http_1_1_http_buffer.html">HttpBuffer</a> <span class="keyword">self</span>;</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;        <span class="keyword">public</span>:</div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;            <a class="code" href="classsock_1_1http_1_1_http_buffer.html#a5851239b1bc568dcbbdf5999b666c8cc">HttpBuffer</a>(<span class="keywordtype">size_t</span> <a class="code" href="classsock_1_1http_1_1_http_buffer.html#aa0094576c0b88d1522df80245fc0760b">size</a> = 0x1000);</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;            <a class="code" href="classsock_1_1http_1_1_http_buffer.html#a36e0255ffdffb0a6b8c81d209dd66329">~HttpBuffer</a>(<span class="keywordtype">void</span>);</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;</div>
<div class="line"><a name="l00039"></a><span class="lineno"><a class="line" href="classsock_1_1http_1_1_http_buffer.html#aa0094576c0b88d1522df80245fc0760b">   39</a></span>&#160;            <span class="keywordtype">size_t</span> <a class="code" href="classsock_1_1http_1_1_http_buffer.html#aa0094576c0b88d1522df80245fc0760b">size</a>(<span class="keywordtype">void</span>) { <span class="keywordflow">return</span> data_.size(); }</div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;        <span class="keyword">public</span>:</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;            <span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00047"></a><span class="lineno"><a class="line" href="classsock_1_1http_1_1_http_buffer.html#acfedfe4b71fd48594403996beba5f4aa">   47</a></span>&#160;            <span class="keywordtype">void</span> <a class="code" href="classsock_1_1http_1_1_http_buffer.html#acfedfe4b71fd48594403996beba5f4aa">appendBasic</a>(T&amp; x)</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;            {</div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;                data_.insert(data_.end(), (<span class="keyword">const</span> <span class="keywordtype">char</span>*)&amp;x, (<span class="keyword">const</span> <span class="keywordtype">char</span>*)(&amp;x + <span class="keyword">sizeof</span>(T)));</div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;            }</div>
<div class="line"><a name="l00056"></a><span class="lineno"><a class="line" href="classsock_1_1http_1_1_http_buffer.html#a1bb09bbc56179c40df4e715ffad4bba4">   56</a></span>&#160;            <span class="keywordtype">void</span> <a class="code" href="classsock_1_1http_1_1_http_buffer.html#a1bb09bbc56179c40df4e715ffad4bba4">appendCharArray</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* x, <span class="keywordtype">size_t</span> length)</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;            {</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;                data_.insert(data_.end(), x, x + length);</div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;            }</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;</div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;        <span class="keyword">public</span>:</div>
<div class="line"><a name="l00062"></a><span class="lineno"><a class="line" href="classsock_1_1http_1_1_http_buffer.html#a4f65ad62003a33cdebca55bf869ab376">   62</a></span>&#160;            <span class="keyword">self</span>&amp; <a class="code" href="classsock_1_1http_1_1_http_buffer.html#a4f65ad62003a33cdebca55bf869ab376">operator&lt;&lt;</a>(<span class="keywordtype">char</span> x)</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;            {</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;                <a class="code" href="classsock_1_1http_1_1_http_buffer.html#acfedfe4b71fd48594403996beba5f4aa">appendBasic</a>(x);</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;                <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;            }</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;</div>
<div class="line"><a name="l00068"></a><span class="lineno"><a class="line" href="classsock_1_1http_1_1_http_buffer.html#ab39f09f59dd694c07b1ca2632bb964ca">   68</a></span>&#160;            <span class="keyword">self</span>&amp; <a class="code" href="classsock_1_1http_1_1_http_buffer.html#ab39f09f59dd694c07b1ca2632bb964ca">operator&lt;&lt;</a>(<span class="keywordtype">short</span> x)</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;            {</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;                <a class="code" href="classsock_1_1http_1_1_http_buffer.html#acfedfe4b71fd48594403996beba5f4aa">appendBasic</a>(x);</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;                <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;            }</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;</div>
<div class="line"><a name="l00074"></a><span class="lineno"><a class="line" href="classsock_1_1http_1_1_http_buffer.html#a6d4be9999aa68e0745857a84b3a5fbdf">   74</a></span>&#160;            <span class="keyword">self</span>&amp; <a class="code" href="classsock_1_1http_1_1_http_buffer.html#a6d4be9999aa68e0745857a84b3a5fbdf">operator&lt;&lt;</a>(<span class="keywordtype">int</span> x)</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;            {</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;                <a class="code" href="classsock_1_1http_1_1_http_buffer.html#acfedfe4b71fd48594403996beba5f4aa">appendBasic</a>(x);</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;                <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;            }</div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;</div>
<div class="line"><a name="l00080"></a><span class="lineno"><a class="line" href="classsock_1_1http_1_1_http_buffer.html#a4c878342e8581e6d186410a17850905c">   80</a></span>&#160;            <span class="keyword">self</span>&amp; <a class="code" href="classsock_1_1http_1_1_http_buffer.html#a4c878342e8581e6d186410a17850905c">operator&lt;&lt;</a>(<span class="keywordtype">long</span> x)</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;            {</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;                <a class="code" href="classsock_1_1http_1_1_http_buffer.html#acfedfe4b71fd48594403996beba5f4aa">appendBasic</a>(x);</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;                <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;            }</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;</div>
<div class="line"><a name="l00086"></a><span class="lineno"><a class="line" href="classsock_1_1http_1_1_http_buffer.html#a78e474f934a3f92497200c4792cfdb0e">   86</a></span>&#160;            <span class="keyword">self</span>&amp; <a class="code" href="classsock_1_1http_1_1_http_buffer.html#a78e474f934a3f92497200c4792cfdb0e">operator&lt;&lt;</a>(<span class="keywordtype">long</span> <span class="keywordtype">long</span> x)</div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;            {</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;                <a class="code" href="classsock_1_1http_1_1_http_buffer.html#acfedfe4b71fd48594403996beba5f4aa">appendBasic</a>(x);</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;                <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;            }</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;</div>
<div class="line"><a name="l00092"></a><span class="lineno"><a class="line" href="classsock_1_1http_1_1_http_buffer.html#a99bb19e3814d43d1eba77e4d33ca2c0d">   92</a></span>&#160;            <span class="keyword">self</span>&amp; <a class="code" href="classsock_1_1http_1_1_http_buffer.html#a99bb19e3814d43d1eba77e4d33ca2c0d">operator&lt;&lt;</a>(<span class="keywordtype">float</span> x)</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;            {</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;                <a class="code" href="classsock_1_1http_1_1_http_buffer.html#acfedfe4b71fd48594403996beba5f4aa">appendBasic</a>(x);</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;                <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;            }</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;</div>
<div class="line"><a name="l00098"></a><span class="lineno"><a class="line" href="classsock_1_1http_1_1_http_buffer.html#a626527f1f248b4fd42a10ee59e9c0d97">   98</a></span>&#160;            <span class="keyword">self</span>&amp; <a class="code" href="classsock_1_1http_1_1_http_buffer.html#a626527f1f248b4fd42a10ee59e9c0d97">operator&lt;&lt;</a>(<span class="keywordtype">double</span> x)</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;            {</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;                <a class="code" href="classsock_1_1http_1_1_http_buffer.html#acfedfe4b71fd48594403996beba5f4aa">appendBasic</a>(x);</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;                <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;            }</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;</div>
<div class="line"><a name="l00104"></a><span class="lineno"><a class="line" href="classsock_1_1http_1_1_http_buffer.html#aa9ff0e2fd6baac5027493983747a00fb">  104</a></span>&#160;            <span class="keyword">self</span>&amp; <a class="code" href="classsock_1_1http_1_1_http_buffer.html#aa9ff0e2fd6baac5027493983747a00fb">operator&lt;&lt;</a>(std::string&amp; x)</div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;            {</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;                <a class="code" href="classsock_1_1http_1_1_http_buffer.html#a1bb09bbc56179c40df4e715ffad4bba4">appendCharArray</a>(&amp;x[0], x.length());</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;                <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;            }</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;</div>
<div class="line"><a name="l00110"></a><span class="lineno"><a class="line" href="classsock_1_1http_1_1_http_buffer.html#ae515aacd8b03322c2d98502cb5529f62">  110</a></span>&#160;            <span class="keyword">self</span>&amp; <a class="code" href="classsock_1_1http_1_1_http_buffer.html#ae515aacd8b03322c2d98502cb5529f62">operator&lt;&lt;</a>(std::string x)</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;            {</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;                <a class="code" href="classsock_1_1http_1_1_http_buffer.html#a1bb09bbc56179c40df4e715ffad4bba4">appendCharArray</a>(&amp;x[0], x.length());</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;                <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;            }</div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;</div>
<div class="line"><a name="l00116"></a><span class="lineno"><a class="line" href="classsock_1_1http_1_1_http_buffer.html#a1f94d20b364e528a213a16b520c52079">  116</a></span>&#160;            <span class="keyword">self</span>&amp; <a class="code" href="classsock_1_1http_1_1_http_buffer.html#a1f94d20b364e528a213a16b520c52079">operator&lt;&lt;</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* x)</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;            {</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;                <a class="code" href="classsock_1_1http_1_1_http_buffer.html#a1bb09bbc56179c40df4e715ffad4bba4">appendCharArray</a>(x, strlen(x));</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;                <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;            }</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;        <span class="keyword">public</span>:</div>
<div class="line"><a name="l00128"></a><span class="lineno"><a class="line" href="classsock_1_1http_1_1_http_buffer.html#ac2fe669f7d4e9230a0efad6e928913d3">  128</a></span>&#160;            <span class="keywordtype">void</span> <a class="code" href="classsock_1_1http_1_1_http_buffer.html#ac2fe669f7d4e9230a0efad6e928913d3">write</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* x, <span class="keywordtype">size_t</span> length)</div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;            {</div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;                data_.insert(data_.end(), x, x + length);</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;            }</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;</div>
<div class="line"><a name="l00137"></a><span class="lineno"><a class="line" href="classsock_1_1http_1_1_http_buffer.html#a93779735c436176f24acd931e0b47e7c">  137</a></span>&#160;            <span class="keywordtype">void</span> <a class="code" href="classsock_1_1http_1_1_http_buffer.html#a93779735c436176f24acd931e0b47e7c">write</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* x)</div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;            {</div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;                data_.insert(data_.end(), x, x + strlen(x));</div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;            }</div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;</div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;        <span class="keyword">private</span>:</div>
<div class="line"><a name="l00143"></a><span class="lineno"><a class="line" href="classsock_1_1http_1_1_http_buffer.html#a3e611175a551b64dda26f513067e0d04">  143</a></span>&#160;            <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classsock_1_1http_1_1_http_session.html">HttpSession</a>;</div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;            <span class="keyword">typedef</span>  std::vector&lt;char&gt; InnerBuffer;</div>
<div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;</div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;        <span class="keyword">private</span>:</div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;            <span class="keywordtype">bool</span> <a class="code" href="classsock_1_1http_1_1_http_buffer.html#ac2fe669f7d4e9230a0efad6e928913d3">write</a>(<a class="code" href="classsock_1_1net_1_1_tcp_connection_output_stream.html">sock::net::TcpConnectionOutputStream</a>&amp; os);</div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;</div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;        <span class="keyword">private</span>:</div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;            <span class="keywordtype">size_t</span> writeIdx_;       <span class="comment">/* 当前输出位置，在输出缓存时使用 */</span></div>
<div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;            InnerBuffer data_;      <span class="comment">/* 数据 */</span></div>
<div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;        };</div>
<div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;</div>
<div class="line"><a name="l00154"></a><span class="lineno"><a class="line" href="namespacesock_1_1http.html#a4e8d5223a27396b63f6a4d96d9f2572b">  154</a></span>&#160;        <span class="keyword">typedef</span> boost::shared_ptr&lt;HttpBuffer&gt; <a class="code" href="namespacesock_1_1http.html#a4e8d5223a27396b63f6a4d96d9f2572b">HttpBufferPtr</a>;</div>
<div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;    }</div>
<div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;}</div>
<div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;</div>
<div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* DEPS_SOCK_SOCK_HTTP_HTTP_BUFFER_H_ */</span><span class="preprocessor"></span></div>
<div class="ttc" id="classsock_1_1http_1_1_http_buffer_html_a6d4be9999aa68e0745857a84b3a5fbdf"><div class="ttname"><a href="classsock_1_1http_1_1_http_buffer.html#a6d4be9999aa68e0745857a84b3a5fbdf">sock::http::HttpBuffer::operator&lt;&lt;</a></div><div class="ttdeci">self &amp; operator&lt;&lt;(int x)</div><div class="ttdef"><b>Definition:</b> http_buffer.h:74</div></div>
<div class="ttc" id="namespacesock_1_1http_html_a4e8d5223a27396b63f6a4d96d9f2572b"><div class="ttname"><a href="namespacesock_1_1http.html#a4e8d5223a27396b63f6a4d96d9f2572b">sock::http::HttpBufferPtr</a></div><div class="ttdeci">boost::shared_ptr&lt; HttpBuffer &gt; HttpBufferPtr</div><div class="ttdef"><b>Definition:</b> http_buffer.h:154</div></div>
<div class="ttc" id="classsock_1_1http_1_1_http_buffer_html_a78e474f934a3f92497200c4792cfdb0e"><div class="ttname"><a href="classsock_1_1http_1_1_http_buffer.html#a78e474f934a3f92497200c4792cfdb0e">sock::http::HttpBuffer::operator&lt;&lt;</a></div><div class="ttdeci">self &amp; operator&lt;&lt;(long long x)</div><div class="ttdef"><b>Definition:</b> http_buffer.h:86</div></div>
<div class="ttc" id="classsock_1_1http_1_1_http_buffer_html_ac2fe669f7d4e9230a0efad6e928913d3"><div class="ttname"><a href="classsock_1_1http_1_1_http_buffer.html#ac2fe669f7d4e9230a0efad6e928913d3">sock::http::HttpBuffer::write</a></div><div class="ttdeci">void write(const char *x, size_t length)</div><div class="ttdoc">向缓存写入数据 </div><div class="ttdef"><b>Definition:</b> http_buffer.h:128</div></div>
<div class="ttc" id="classsock_1_1http_1_1_http_buffer_html_ab39f09f59dd694c07b1ca2632bb964ca"><div class="ttname"><a href="classsock_1_1http_1_1_http_buffer.html#ab39f09f59dd694c07b1ca2632bb964ca">sock::http::HttpBuffer::operator&lt;&lt;</a></div><div class="ttdeci">self &amp; operator&lt;&lt;(short x)</div><div class="ttdef"><b>Definition:</b> http_buffer.h:68</div></div>
<div class="ttc" id="tcp__connection__output__stream_8h_html"><div class="ttname"><a href="tcp__connection__output__stream_8h.html">tcp_connection_output_stream.h</a></div></div>
<div class="ttc" id="classsock_1_1http_1_1_http_buffer_html_ae515aacd8b03322c2d98502cb5529f62"><div class="ttname"><a href="classsock_1_1http_1_1_http_buffer.html#ae515aacd8b03322c2d98502cb5529f62">sock::http::HttpBuffer::operator&lt;&lt;</a></div><div class="ttdeci">self &amp; operator&lt;&lt;(std::string x)</div><div class="ttdef"><b>Definition:</b> http_buffer.h:110</div></div>
<div class="ttc" id="classsock_1_1http_1_1_http_buffer_html_a1f94d20b364e528a213a16b520c52079"><div class="ttname"><a href="classsock_1_1http_1_1_http_buffer.html#a1f94d20b364e528a213a16b520c52079">sock::http::HttpBuffer::operator&lt;&lt;</a></div><div class="ttdeci">self &amp; operator&lt;&lt;(const char *x)</div><div class="ttdef"><b>Definition:</b> http_buffer.h:116</div></div>
<div class="ttc" id="classsock_1_1http_1_1_http_buffer_html_a93779735c436176f24acd931e0b47e7c"><div class="ttname"><a href="classsock_1_1http_1_1_http_buffer.html#a93779735c436176f24acd931e0b47e7c">sock::http::HttpBuffer::write</a></div><div class="ttdeci">void write(const char *x)</div><div class="ttdoc">向缓存写入C字符串 </div><div class="ttdef"><b>Definition:</b> http_buffer.h:137</div></div>
<div class="ttc" id="classsock_1_1http_1_1_http_session_html"><div class="ttname"><a href="classsock_1_1http_1_1_http_session.html">sock::http::HttpSession</a></div><div class="ttdoc">HTTP Session. </div><div class="ttdef"><b>Definition:</b> http_session.h:28</div></div>
<div class="ttc" id="namespacesock_html"><div class="ttname"><a href="namespacesock.html">sock</a></div><div class="ttdef"><b>Definition:</b> atomic.h:17</div></div>
<div class="ttc" id="classsock_1_1net_1_1_tcp_connection_output_stream_html"><div class="ttname"><a href="classsock_1_1net_1_1_tcp_connection_output_stream.html">sock::net::TcpConnectionOutputStream</a></div><div class="ttdoc">Tcp连接输出流 </div><div class="ttdef"><b>Definition:</b> tcp_connection_output_stream.h:20</div></div>
<div class="ttc" id="classsock_1_1http_1_1_http_buffer_html_a4c878342e8581e6d186410a17850905c"><div class="ttname"><a href="classsock_1_1http_1_1_http_buffer.html#a4c878342e8581e6d186410a17850905c">sock::http::HttpBuffer::operator&lt;&lt;</a></div><div class="ttdeci">self &amp; operator&lt;&lt;(long x)</div><div class="ttdef"><b>Definition:</b> http_buffer.h:80</div></div>
<div class="ttc" id="classsock_1_1http_1_1_http_buffer_html_a99bb19e3814d43d1eba77e4d33ca2c0d"><div class="ttname"><a href="classsock_1_1http_1_1_http_buffer.html#a99bb19e3814d43d1eba77e4d33ca2c0d">sock::http::HttpBuffer::operator&lt;&lt;</a></div><div class="ttdeci">self &amp; operator&lt;&lt;(float x)</div><div class="ttdef"><b>Definition:</b> http_buffer.h:92</div></div>
<div class="ttc" id="classsock_1_1http_1_1_http_buffer_html_a5851239b1bc568dcbbdf5999b666c8cc"><div class="ttname"><a href="classsock_1_1http_1_1_http_buffer.html#a5851239b1bc568dcbbdf5999b666c8cc">sock::http::HttpBuffer::HttpBuffer</a></div><div class="ttdeci">HttpBuffer(size_t size=0x1000)</div><div class="ttdef"><b>Definition:</b> http_buffer.cc:11</div></div>
<div class="ttc" id="classsock_1_1http_1_1_http_buffer_html_a4f65ad62003a33cdebca55bf869ab376"><div class="ttname"><a href="classsock_1_1http_1_1_http_buffer.html#a4f65ad62003a33cdebca55bf869ab376">sock::http::HttpBuffer::operator&lt;&lt;</a></div><div class="ttdeci">self &amp; operator&lt;&lt;(char x)</div><div class="ttdef"><b>Definition:</b> http_buffer.h:62</div></div>
<div class="ttc" id="classsock_1_1http_1_1_http_buffer_html_a1bb09bbc56179c40df4e715ffad4bba4"><div class="ttname"><a href="classsock_1_1http_1_1_http_buffer.html#a1bb09bbc56179c40df4e715ffad4bba4">sock::http::HttpBuffer::appendCharArray</a></div><div class="ttdeci">void appendCharArray(const char *x, size_t length)</div><div class="ttdoc">在缓存末尾写入字符串数组 </div><div class="ttdef"><b>Definition:</b> http_buffer.h:56</div></div>
<div class="ttc" id="classsock_1_1http_1_1_http_buffer_html_a36e0255ffdffb0a6b8c81d209dd66329"><div class="ttname"><a href="classsock_1_1http_1_1_http_buffer.html#a36e0255ffdffb0a6b8c81d209dd66329">sock::http::HttpBuffer::~HttpBuffer</a></div><div class="ttdeci">~HttpBuffer(void)</div><div class="ttdef"><b>Definition:</b> http_buffer.cc:18</div></div>
<div class="ttc" id="classsock_1_1http_1_1_http_buffer_html_acfedfe4b71fd48594403996beba5f4aa"><div class="ttname"><a href="classsock_1_1http_1_1_http_buffer.html#acfedfe4b71fd48594403996beba5f4aa">sock::http::HttpBuffer::appendBasic</a></div><div class="ttdeci">void appendBasic(T &amp;x)</div><div class="ttdoc">在流末尾写入基础类型 </div><div class="ttdef"><b>Definition:</b> http_buffer.h:47</div></div>
<div class="ttc" id="classsock_1_1http_1_1_http_buffer_html_aa0094576c0b88d1522df80245fc0760b"><div class="ttname"><a href="classsock_1_1http_1_1_http_buffer.html#aa0094576c0b88d1522df80245fc0760b">sock::http::HttpBuffer::size</a></div><div class="ttdeci">size_t size(void)</div><div class="ttdoc">获取缓存数据长度 </div><div class="ttdef"><b>Definition:</b> http_buffer.h:39</div></div>
<div class="ttc" id="classsock_1_1http_1_1_http_buffer_html_aa9ff0e2fd6baac5027493983747a00fb"><div class="ttname"><a href="classsock_1_1http_1_1_http_buffer.html#aa9ff0e2fd6baac5027493983747a00fb">sock::http::HttpBuffer::operator&lt;&lt;</a></div><div class="ttdeci">self &amp; operator&lt;&lt;(std::string &amp;x)</div><div class="ttdef"><b>Definition:</b> http_buffer.h:104</div></div>
<div class="ttc" id="classsock_1_1http_1_1_http_buffer_html"><div class="ttname"><a href="classsock_1_1http_1_1_http_buffer.html">sock::http::HttpBuffer</a></div><div class="ttdoc">缓存类，在响应中存数数据 </div><div class="ttdef"><b>Definition:</b> http_buffer.h:27</div></div>
<div class="ttc" id="classsock_1_1http_1_1_http_buffer_html_a626527f1f248b4fd42a10ee59e9c0d97"><div class="ttname"><a href="classsock_1_1http_1_1_http_buffer.html#a626527f1f248b4fd42a10ee59e9c0d97">sock::http::HttpBuffer::operator&lt;&lt;</a></div><div class="ttdeci">self &amp; operator&lt;&lt;(double x)</div><div class="ttdef"><b>Definition:</b> http_buffer.h:98</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.10
</small></address>
</body>
</html>
